﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 控制台测试.Service
{
    public class UserService3
    {
        private static UserService3 instance;
        private static readonly object lockObj = new object();
        private UserService3() { }

        public static UserService3 GetInstance()
        { 
            if(instance==null)
            {
                lock(lockObj)
                {
                    if(instance == null)
                    {
                        instance = new UserService3();
                    }
                }
            }

            return instance;
        }

        public void ShowHashCode()
        {
            Console.WriteLine(instance.GetHashCode());
        }
    }
}
